package com.bootdoolvillage.wow.api.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Properties;

public class ConfigurationLoader {
	private static final String CONFIG_FILENAME = "./config.properties";

	public static Properties readProperties() {
		Properties pro = new Properties();
		FileInputStream fis = null;
		try {
			URL url = ClassLoader.getSystemResource(CONFIG_FILENAME);
			fis = new FileInputStream(new File(url.getFile()));
			if (fis != null) {
				pro.load(new InputStreamReader(fis));
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (fis != null) {
					fis.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return pro;
	}
}
